package com.yanqu.road.entity.activity.tongbing.data;

import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.DataStatus;
import com.yanqu.road.entity.FieldTypeAnnotation;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * 阵营数据
 */
@FieldTypeAnnotation(tableName = "t_c_tongbing_camp_data")
public class CrossTongBingCampData extends DataObject {

    @FieldTypeAnnotation(desc = "活动ID", select = true, update = true)
    private int activityId;

    @FieldTypeAnnotation(desc = "活动分组ID")
    private int groupId;

    @FieldTypeAnnotation(desc = "阵营ID", update = true)
    private int campId;

    @FieldTypeAnnotation(desc = "城池采集收益（玩家ID，城池ID，数量）")
    private Map<Long, Map<Integer, Long>> collectionMap = new ConcurrentHashMap<>();

    @FieldTypeAnnotation(desc = "阵营红包（阵营内唯一编号,红包数据)")
    private Map<Long, CrossTongBingRedPacket> redPacketMap = new ConcurrentHashMap<>();

    @FieldTypeAnnotation(desc = "阵营红包值")
    private long redPacketValue = 0L;

    @FieldTypeAnnotation(desc = "指挥官数据")
    private CrossTongBingCommanderData commanderData;

    // ===================== 不入库 =====================

    // 玩家红包数量
    private Map<Long, CrossTongBingUserRedPacketCount> userRedPacketMap = new ConcurrentHashMap<>();

    // ==================================================

    public int getActivityId() {
        return activityId;
    }

    public void setActivityId(int activityId) {
        if (this.activityId != activityId) {
            this.activityId = activityId;
            setOp(DataStatus.Update);
        }
    }

    public int getCampId() {
        return campId;
    }

    public void setCampId(int campId) {
        if (this.campId != campId) {
            this.campId = campId;
            setOp(DataStatus.Update);
        }
    }

    public Map<Long, Map<Integer, Long>> getCollectionMap() {
        return collectionMap;
    }

    public void setCollectionMap(ConcurrentHashMap<Long, ConcurrentHashMap<Integer, Long>> collectionMap) {
        if (null == collectionMap) {
            return;
        }
        this.collectionMap = new ConcurrentHashMap<>(collectionMap);
        setOp(DataStatus.Update);
    }

    public Map<Long, CrossTongBingRedPacket> getRedPacketMap() {
        return redPacketMap;
    }

    public void setRedPacketMap(Map<Long, CrossTongBingRedPacket> redPacketMap) {
        if (null == redPacketMap) {
            return;
        }
        this.redPacketMap = redPacketMap;
        setOp(DataStatus.Update);
    }

    public long getRedPacketValue() {
        return redPacketValue;
    }

    public void setRedPacketValue(long redPacketValue) {
        if (this.redPacketValue != redPacketValue) {
            this.redPacketValue = redPacketValue;
            setOp(DataStatus.Update);
        }
    }

    public CrossTongBingCommanderData getCommanderData() {
        return commanderData;
    }

    public void setCommanderData(CrossTongBingCommanderData commanderData) {
        if (commanderData == null) {
            return;
        }
        this.commanderData = commanderData;
        setOp(DataStatus.Update);
    }

    public int getGroupId() {
        return groupId;
    }

    public void setGroupId(int groupId) {
        if (this.groupId != groupId) {
            this.groupId = groupId;
            setUpdateOption();
        }
    }

    // ========= 不需要入库 =========

    public Map<Long, CrossTongBingUserRedPacketCount> getUserRedPacketMap() {
        return userRedPacketMap;
    }

    public void setUserRedPacketMap(Map<Long, CrossTongBingUserRedPacketCount> userRedPacketMap) {
        this.userRedPacketMap = userRedPacketMap;
    }
}
